#ifndef LIB_TD_CMD_H
#define LIB_TD_CMD_H
#include <stdint.h>

#define DISABLE 0
#define ENABLE 1
#define CMD_TYPE_INT DISABLE  // 默认整型命令
#define CMD_TYPE_STR ENABLE // 字符串命令

#if CMD_TYPE_INT
// TODO, 定义命令, 可根据实际需求修改
typedef enum
{
    CMD1 = 0x01,
    CMD2 = 0x02,
    CMD3 = 0x03,
    CMD4 = 0x04
} Command;

typedef struct
{
    uint16_t CMD;
    void (*callback_func)(uint8_t cmd, uint8_t *msg, uint8_t len);
} _FUNCCALLBACK;


void lib_td_cmd_init(_FUNCCALLBACK *cb_list, uint16_t cmd_list_max);
void lib_td_cmd_poll_task(uint8_t cmd, uint8_t *msg, uint8_t len);

#endif


// String类型命令
#if CMD_TYPE_STR

// 声明 commands 数组
extern const Command commands[];

typedef struct
{
    uint16_t CMD;
    void (*callback_func)(uint8_t cmd, uint8_t *msg, uint8_t len);
} _FUNCCALLBACK;

void lib_td_cmd_init(_FUNCCALLBACK *cb_list, uint16_t cmd_list_max);
void lib_td_cmd_poll_task(uint8_t cmd, uint8_t *msg, uint8_t len);

#endif


#endif // LIB_TD_CMD_H